// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   NumberPoolRouter.java

package cn.sendsms;

import java.util.*;

// Referenced classes of package cn.sendsms:
//			Router, AGateway, OutboundMessage, Service

public class NumberPoolRouter extends Router
{

	protected Map assignments;

	public NumberPoolRouter(Service service)
	{
		super(service);
		assignments = new HashMap();
	}

	public void assign(String prefix, AGateway gw)
	{
		assignments.put(prefix, gw.getGatewayId());
	}

	public void customRouting(OutboundMessage msg)
	{
		Iterator it = assignments.keySet().iterator();
		do
		{
			if (!it.hasNext())
				break;
			String prefix = (String)it.next();
			if (msg.getRecipient().startsWith(prefix))
				allowed.add(service.findGateway((String)assignments.get(prefix)));
		} while (true);
	}
}
